<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    function Common(name,age,gender) {
            this.name = name
            this.age = age
            this.gender = gender
    }
    Common.prototype.exam = function() {
        console.log(1111111111)
    }
    function Student(name,age,gender,score) {
            // 在这里想要common里的属性
            Common.call(this,name,age,gender)   //common内部的this指向Student的实例
            this.score = score
    }
    // Student.prototype = Common.prototype;  //对象会开辟一个作用域,在内存中指向了同一份
    Student.prototype = new Common()  //拥有独立的作用域
    Student.prototype.constructor = Student;
    Student.prototype.ss = function() {
        console.log(3333)
    }
    var s1 = new Student("ss",23,"男",90)
    console.log(s1)
    function Person(name,age,gender,score) {
            // 在这里想要common里的属性
            Common.call(this,name,age,gender)   //common内部的this指向Student的实例
            this.score = score
    }
    // Person.prototype = Common.prototype;  //内存中指向了同一份
    Person.prototype = new Common()   //拥有独立的作用域
    Person.prototype.constructor = Person;
    var p1 = new Person("pp",67,"男",90)
    console.log(p1)
    </script>
</body>
</html>